package com.sykj.springboot.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sykj.springboot.dao.UserDao;
import com.sykj.springboot.entity.User;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {

	@Autowired
	private UserDao userDao;

	public User getUserById(String id) {
		return userDao.getUserById(id);
	}

	@Transactional(rollbackFor=Exception.class)
	public boolean insertUserInfo(User user) throws Exception{
		Boolean flag = userDao.insertUserInfo(user) >1?true:false;
		User userById = getUserById(user.getId());
		return flag;
	}
}
